<?php
    define('NORMAL_RUN', 1);



    // APP_PATH папка приложения на сервере, полный путь
    $path_arr = explode(DIRECTORY_SEPARATOR, realpath(dirname(__FILE__)));
    unset($path_arr[count($path_arr)-1]);
    define('APP_PATH', join(DIRECTORY_SEPARATOR, $path_arr).DIRECTORY_SEPARATOR );


    // reports
    unset($path_arr[count($path_arr)-1]);
    define('RP_APP_PATH', join(DIRECTORY_SEPARATOR, $path_arr).DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR );


    unset($path_arr);

    // HTML_PATH ссылка на корневую директорию для html
    $html_arr = explode('/',$_SERVER['PHP_SELF']);
    if (is_array($html_arr) && count($html_arr)) array_pop($html_arr);
    define('HTML_PATH', join('/', $html_arr).'/' );
    array_pop($html_arr);
    define('RP_HTML_PATH', join('/', $html_arr).'/app/' );
    unset($html_arr);

    define('REQUEST_SELF', $_SERVER['PHP_SELF']);


    // имена папок со статическим контентом
    define('CSS_FILES_DIR', 'css');
    define('JS_FILES_DIR',  'js');
    define('IMG_FILES_DIR', 'img');


    // пути к ресурсам
    define('APP_FILES',             APP_PATH.'application'.DIRECTORY_SEPARATOR);
    define('APP_LIB_FILES',         APP_FILES.'lib'.DIRECTORY_SEPARATOR);
    define('APP_PAGE_PARTS',        APP_FILES.'parts'.DIRECTORY_SEPARATOR);


    // ссылки на ресурсы re-ports
    define('RP_APP_FILES',          RP_APP_PATH.'application'.DIRECTORY_SEPARATOR);
    define('RP_APP_LIB_FILES',      RP_APP_FILES.'lib'.DIRECTORY_SEPARATOR);
    define('RP_APP_DATA_LOAD_FILES',RP_APP_FILES.'loaders'.DIRECTORY_SEPARATOR);
    
    // 
    define('RP_IMG_FILES_DIR', 'img');
    define('AVA_FILES_DIR', 'users');
    define('DEF_AVA', '0.png');
    
    // ссылки на статический контент из HTML
    define('APP_HTML_CSS_PATH',     HTML_PATH.CSS_FILES_DIR.'/');
    define('APP_HTML_JS_PATH',      HTML_PATH.JS_FILES_DIR.'/');
    define('APP_HTML_IMG_PATH',     HTML_PATH.IMG_FILES_DIR.'/');
    define('APP_HTML_AVA_PATH',     RP_HTML_PATH.RP_IMG_FILES_DIR.'/'.AVA_FILES_DIR.'/');
    define('APP_HTML_DEF_AVA',      APP_HTML_AVA_PATH.DEF_AVA);

    // ссылки на статический контент из PHP скриптов
    define('APP_FILES_CSS_PATH',    APP_PATH.CSS_FILES_DIR.DIRECTORY_SEPARATOR);
    define('APP_FILES_JS_PATH',     APP_PATH.JS_FILES_DIR.DIRECTORY_SEPARATOR);
    define('APP_FILES_IMG_PATH',    APP_PATH.IMG_FILES_DIR.DIRECTORY_SEPARATOR);
    
    define('APP_FILES_AVA_PATH',    RP_APP_PATH.RP_IMG_FILES_DIR.DIRECTORY_SEPARATOR.AVA_FILES_DIR.DIRECTORY_SEPARATOR);
    define('APP_FILES_DEF_AVA',     APP_FILES_AVA_PATH.DEF_AVA);

    

    include_once RP_APP_LIB_FILES.'constants.php';
    

    include_once APP_LIB_FILES.'constants.php';
    include_once APP_LIB_FILES.'functions.php';
    include_once APP_LIB_FILES.'arr.php';
    include_once APP_LIB_FILES.'trace.php';

    include_once APP_LIB_FILES.'auth.php';
    include_once APP_LIB_FILES.'db.php';
    include_once APP_LIB_FILES.'msdb.php';
    
    include_once APP_LIB_FILES.'json.php';
    include_once APP_LIB_FILES.'reason.php';
    include_once APP_LIB_FILES.'conceptions.php';

    include_once APP_LIB_FILES.'floor.php';
    include_once APP_LIB_FILES.'flds.php';
    
    include_once APP_LIB_FILES.'useravatar.php';

    include_once APP_LIB_FILES.'navbar.php';
    include_once APP_LIB_FILES.'log.php';





?>